﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddEquipments.aspx.cs" Inherits="ForestryEnterprise.AddEquipments" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style2
        {
            width: 149px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <h2>Add Equipments</h2>
    <div>
    
        <table class="style1">
            <tr>
                <td class="style2">
                    <asp:Label ID="Label1" runat="server" Text="Name"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="EqName" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    <asp:Label ID="Label2" runat="server" Text="Status"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="EqStatus" runat="server">
                        <asp:ListItem>Good condition</asp:ListItem>
                        <asp:ListItem>Repair</asp:ListItem>
                        <asp:ListItem>Not work</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    <asp:Label ID="Label3" runat="server" Text="Used"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="EqUsed" runat="server">
                        <asp:ListItem Value="Yes">Yes</asp:ListItem>
                        <asp:ListItem Value="No">No</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    <asp:Label ID="Label4" runat="server" Text="Type"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="EqType" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    <asp:Label ID="Label5" runat="server" Text="Date"></asp:Label>
                </td>
                <td>
                    <asp:Calendar ID="Calendar1" runat="server"></asp:Calendar>
                </td>
            </tr>
            <tr>
                <td class="style2">
                    <asp:Button ID="AddButton" runat="server" onclick="AddButton_Click" 
                        Text="Add new" />
                </td>
                <td>
                    <asp:Label ID="err" runat="server"></asp:Label>
                </td>
            </tr>
            </table>
        <br />
        <asp:GridView ID="EquipDataView" runat="server" DataSourceID="EquipData" 
            EnableModelValidation="True" AutoGenerateColumns="False" 
            onselectedindexchanged="EquipDataView_SelectedIndexChanged">
            <Columns>
                <asp:CommandField HeaderText="Update" SelectText="update" 
                    ShowSelectButton="True" />
                <asp:BoundField DataField="eq_id" HeaderText="Equipment Id" 
                    InsertVisible="False" ReadOnly="True" SortExpression="eq_id" />
                <asp:BoundField DataField="eq_name" HeaderText="Name" />
                <asp:BoundField DataField="eq_status" HeaderText="Status" />
                <asp:BoundField DataField="eq_used" HeaderText="Used" />
                <asp:BoundField DataField="eq_type" HeaderText="Type" 
                    SortExpression="eq_type" />
                <asp:BoundField DataField="eq_date" HeaderText="Date" />
            </Columns>
        </asp:GridView>
        <asp:AccessDataSource ID="EquipData" runat="server" 
            DataFile="~/App_Data/ForestryEnterprise.mdb" 
            SelectCommand="SELECT * FROM [Equipment]"></asp:AccessDataSource>
        <br />
        <br />
    
    </div>
     <div id="updateItem" runat="server" visible="false">
            <hr />
            <asp:TextBox ID="updateName" runat="server" />
            <asp:TextBox ID="updateStatus" runat="server" />
            <asp:TextBox ID="updateUsed" runat="server" />
            <asp:TextBox ID="updateType" runat="server"></asp:TextBox>
            <asp:TextBox ID="updateDate" runat="server"></asp:TextBox>
            <asp:Button ID="update" Text="Update" runat="server" onclick="update_Click" />
            <asp:Button ID="cancel" Text="Cancel" runat="server" onclick="cancel_Click" />
        </div>
    </form>
</body>
</html>
